package ru.vsu.cs.pm;

import org.apache.wicket.Request;
import org.apache.wicket.Session;
import org.apache.wicket.protocol.http.WebSession;
import ru.vsu.cs.pm.models.User;

/**
 * User: Oleg
 * Date: 19.12.2010
 */
public class PMSession extends WebSession {

    private User user;

    public PMSession(Request request) {
        super(request);
    }

    public static PMSession get() {
        return (PMSession) Session.get();
    }

    public void setAuthenticatedUser(User user) {
        this.user = user;
    }

    public User getAuthenticatedUser() {
        return user;
    }

    public void signOut() {
        invalidateNow();
    }

    public boolean isSignedIn() {
        return this.getAuthenticatedUser() != null;
    }
}
